import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

public class UdpDictServer extends  UdpEchoServer{
	Map<String, String > dict=new HashMap<>();
	@Override
	public String process(String request) {

		return dict.getOrDefault(request,"该词不在词典中");
	}

	public UdpDictServer(int port) throws SocketException {
		super(port);
		dict.put("cat","小猫");
		dict.put("dog","小狗");
		dict.put("pig","小猪");
		dict.put("sleep","绵羊");
	}

	public static void main(String[] args) throws IOException {
		UdpDictServer dictServer=new UdpDictServer(9090);
		dictServer.start();
	}
}
